package lab02.test29;

import java.util.InputMismatchException;
import java.util.Scanner;

/**
 * Created by Administrator on 2017/11/2.
 */
public class Test {
    public static void main(String[] args) {
        int i = 0;
        System.out.println("请输入你要查询的数组下标：");
        Scanner scanner=new Scanner(System.in);

        try {
            i=scanner.nextInt();
        }catch (InputMismatchException e){
            System.out.println("类型不配陪！！");
        }

        int[] numbers=new int[5];
        numbers[0]=12;
        numbers[1]=14;
        numbers[2]=16;
        numbers[3]=18;
        numbers[4]=20;

       try {
           System.out.println(numbers[i]);
       }
       catch (ArrayIndexOutOfBoundsException e){
           System.out.println("数组下标越界！！");
       }finally {
           System.out.println("不管怎样都会执行的代码！！");
       }
    }
}
